package com.example.demo.Controller;

import com.example.demo.service.adminService.AdminService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/admin")
public class adminController {
@Resource
    AdminService adminService;
    @PostMapping("/adminLogin")
    public  String  ad_login(@RequestParam("user-name")String aname,
                             @RequestParam("user-password") String apwd,
                             HttpServletRequest request){
        if ( adminService.findAdmin(aname,apwd)){
            return "manage_menu";
        }
      request.getSession().setAttribute("errorMsg","管理员账号不存在");
      return "manage_login";
    }
    @GetMapping("furnManage")
    public String furnManage(){

        return  "furn_manage";
    }

}
